home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 34 / Mac Magazin and MacEasy Magazine CD - Issue 34.iso / Grafik & Text / Alpha ƒ / Tcl / SystemCode / paths.tcl < prev    next >
Text File  |  1996-08-15  |  2KB  |  64 lines

  1.  
  2. if {$alphaLite} return
  3.  
  4. # Any directory must have 'folder' somewhere in the comment.
  5. set pathComments(TeXInputs)            "TeX Inputs folder"
  6. set pathComments(eudoraNicknames)    "Eudora Nickname File"
  7. set pathComments(perlFilterPath)     "MacPerl Text Filters folder"
  8. set pathComments(perlDocs)             "MacPerl documentation folder"
  9. set pathComments(perlLib)             "MacPerl lib folder"
  10. # set pathComments(cIncludePath)    "C include path"
  11.  
  12. set cIncludePath    ""
  13.  
  14. set tmp {}
  15. foreach n [array names pathComments] {
  16.     lappend tmp $pathComments($n)
  17. }
  18. menu -n appPaths -m -p pathProc [lsort $tmp]
  19. unset tmp
  20.  
  21.  
  22. #===============================================================================
  23.  
  24. proc pathProc {menu comment} {
  25.     global pathComments modifiedVars pathSig pathUseIC
  26.  
  27.     foreach path [array names pathComments] {
  28.         if {$pathComments($path) == $comment} {
  29.             global $path                
  30.             if {[info exists $path]} {
  31.                 set buttons {OK Change Remove}
  32.                 if {[info exists pathUseIC($path)]} {
  33.                     lappend buttons "IConfig"
  34.                 }
  35.                 set val [set $path]
  36.             } else {
  37.                 set buttons {OK Set Remove}
  38.                 set val {}
  39.             }
  40.             
  41.             set res [eval [list buttonAlert "$pathComments($path):\r$val"] $buttons]
  42.  
  43.             switch $res {
  44.                 "Set"        "-"
  45.                 "Change"     {     if {[regexp -nocase {.*folder.*} $pathComments($path)]} {
  46.                                     set $path [get_directory -p "Select $pathComments($path):"]
  47.                                 } else {
  48.                                     set $path [getfile "Select $pathComments($path):"]
  49.                                 }
  50.                 
  51.                                 lappend modifiedVars $path
  52.                                 if {[info exists pathSig($path)]} {
  53.                                     global $pathSig($path)
  54.                                     set $pathSig($path) [getFileSig [set $path]]
  55.                                     lappend modifiedVars $pathSig($path)
  56.                                 }
  57.                 }
  58.                 "Remove"    { set $path {} }
  59.             }
  60.             return
  61.         }
  62.     }
  63. }
  64.